﻿#include<iostream>
#include<string>
using namespace std;
class MyStack;
class listNode 
{
    friend class MyStack;
    friend class MyQueue;
private:
    listNode *before = NULL;
    listNode* next=NULL;
    int data;
public:
    listNode(){};
    ~listNode(){};
    listNode(int nodeData, listNode* succ = NULL){};
};

class MyStack
{
    friend bool postfixExpression(const string& str, string& result);
    friend bool expressionVal(const string& str, int& result);
private:
    listNode* topNode;//栈顶
    int stackSize;//len
public:
    MyStack();
    ~MyStack();

    bool push(const int&);
    bool pop(int&);
    bool getTop(int&);
    void printStack();
    bool push(const char&);
    bool pop(char&);
    bool getTop(char&);
};

class MyQueue
{
private:
    int capacity;
    listNode *first = NULL;
    listNode *last = NULL;
    listNode *cnt = NULL;
    int size = 0;

public:
    MyQueue(const int &);
    ~MyQueue();
    bool enQueue(const int &);
    bool deQueue(int &);
    bool getFront(int &);
    void printQueue();
    bool isFull();
};
class stacker
{
private:
    int topn = 0;
    int maxcapacity;
    string *s = NULL;

public:
    stacker();
    stacker(const int &n);
    ~stacker();
    bool empty();
    bool full();
    void push(string a);
    void pop();
    int size();
    string top();
    string *output();
};
bool postfixExpression(const string&, string&);

bool expressionVal(const string&, int&);

void yanghui(const int&);



